<template>
	<view class="indexs">
		<view class="header header_wi" :style="'padding-top: ' + navH + 'px;'">
			<view class="header_height" :style="'height:' + gaodu + 'px;line-height:' + gaodu + 'px;top:' + gaodutops + 'px;'">
				<view class="index_h_cont3">
					<view class="index_wenben_img" @tap="jumpzuo"><image :src="imgUrl + '/dzx_img33.png'" mode="widthFix"></image></view>
					<view class="index_wenben">{{ xiangqing.article_title }}</view>
				</view>
			</view>
			<view class="coloe_title">s</view>
		</view>
		<view class="index_center" :style="'padding-top:' + (navH + 50) + 'px;'">
			<view class="my_jinyun_details">
				<!-- <rich-text :nodes="article_content"></rich-text> -->
				<mp-html :content="article_content" />
			</view>
		</view>
	</view>
</template>

<script>
// pages/shouye/shouye_zkc/shouye_zkc.js
const app = getApp();

let request = require('../../../utils/require');

export default {
	data() {
		return {
			navH: app.globalData.navHeight,
			gaodu: app.globalData.height,
			gaodutops: app.globalData.top,
			imgUrl: app.globalData.imgUrl,
			optionsid: '',

			xiangqing: {
				article_title: ''
			},
			rtype:1,
			article_content: ''
		};
	},
	/**
	 * 生命周期函数--监听页面加载
	 */ 
	onLoad(options) {
		var that = this;
		that.optionsid = options.id
		that.rtype = options.rtype
		that.xinshouwenti();
	},
	onShow() {
		var that = this;
	},
	/**
	 * 生命周期函数--监听页面初次渲染完成
	 */
	onReady: function() {},
	/**
	 * 生命周期函数--监听页面隐藏
	 */
	onHide: function() {},
	/**
	 * 生命周期函数--监听页面卸载
	 */
	onUnload: function() {},
	/**
	 * 页面相关事件处理函数--监听用户下拉动作
	 */
	onPullDownRefresh: function() {},
	/**
	 * 页面上拉触底事件的处理函数
	 */
	onReachBottom: function() {},
	//分享
	onShareAppMessage: function(options) {
		var that = this;
		var thisUserInfo = uni.getStorageSync('userInfo');
		var shareObj = {
			title: xiangqing.article_title,
			desc: xiangqing.article_title,
			// 默认是小程序的名称(可以写SOGO express集运等)
			path: '/pages/mys/my_jinyun_details/my_jinyun_details?id=' + that.optionsid  + '&rtype=10&scene=uid%3A' + thisUserInfo.user_id,
			// thisUserInfo.user_id
			// scene: "uid%3A15027"
			// 默认是当前页面，必须是以‘/’开头的完整路径
			imageUrl: '',
			//自定义图片路径，可以是本地文件路径、代码包文件路径或者网络图片路径，支持PNG及JPG，不传入 imageUrl 则使用默认截图。显示图片长宽比是 5:4
			success: function(res) {
				// 转发成功之后的回调
				if (res.errMsg == 'shareAppMessage:ok') {
				}
			},
			fail: function() {
				// 转发失败之后的回调
				if (res.errMsg == 'shareAppMessage:fail cancel') {
					// 用户取消转发
				} else {
					if (res.errMsg == 'shareAppMessage:fail') {
					}
				}
			}
		};
		return shareObj;
	},
	/**
	 * 用户点击右上角分享
	 */
	onShareTimeline: function() {
		var that = this;
		return {
			title: xiangqing.article_title,
			query: {
				key: '/pages/mys/my_jinyun_details/my_jinyun_details?id=' + that.optionsid  + '&rtype=10'
			},
			imageUrl: ''
		};
	},
	methods: {
		//新手详情
		xinshouwenti() {
			var that = this;
			var data = {
				token: uni.getStorageSync('token'),
				article_id: that.optionsid
			};
			request.post(`index.php?s=/api/Article/detail&wxapp_id=` + uni.getStorageSync('web_id'), data).then(res => {
				if (res.data.code == 1) {
					var article_content = res.data.data.detail.article_content;
					article_content = article_content.replace(/<img/gi, '<img style="max-width:100%;height:auto;display:block" ');
					article_content = article_content.replace(/<video/gi, '<video style="width:100vh;height:80vh !important;" ');
					that.xiangqing = res.data.data.detail
					that.article_content = article_content
					console.log(res, 'ressss');
				}
			});
		},
		jumpzuo() {
			console.log(898988);
			if (this.rtype == 10) {
				uni.navigateTo({
					url: '/pages/index/index'
				});
			}
			uni.navigateBack();
		}
	}
};
</script>
<style>
@import './my_jinyun_details.css';
</style>
